package com.sylingd.blog.lib

object Config {
	const val apiUrl = "https://blog.sylingd.com/api/"
	const val baseUrl = "https://blog.sylingd.com/archives/"
	private val articleRegex = Regex("""^https?://blog\.sylingd\.com/archives/(\d+).html""")

	fun isArticle(url: String): Boolean {
		return articleRegex.matches(url)
	}
	fun getArticleId(url: String): Int {
		val r = articleRegex.find(url)!!.value
		return articleRegex.replace(r, "$1").toInt()
	}
	fun getArticleUrl(id: Int): String {
		return "https://blog.sylingd.com/archives/$id.html"
	}

}